<?php

namespace App\Models;

use App\Services\QuotaServices;
use Dcat\Admin\Traits\HasDateTimeFormatter;
/**
 * This is the model class for table "user_deposit_methods"
 *
 * @property string $id
 * @property string $name 名称
 * @property string $type 类型 1链 2银行卡
 * @property string $params 参数
 * @property string $status 状态 0关 1开
 * @property string $created_at 创建时间
 * @property string $updated_at 更新时间
 */

class UserDepositMethod extends BaseModel
{
    use HasDateTimeFormatter;

    protected $table = 'user_deposit_methods';

    public static function methodList()
    {
        $result = self::list();
        foreach ($result['list'] as &$v) {
            $v['type_text'] = tt_deposit_method($v['type']);
            $v['params'] = json_decode($v['params'],true);
            $v['unit_price'] = isset($v['params']['unit_symbol']) && $v['params']['unit_symbol'] ? QuotaServices::getUnitPrice($v['params']['unit_symbol']): 1;
        }
        return $result;
    }

}
